#define _CRT_SECURE_NO_WARNINGS 1

#include"stack.h"
void test() {
	stack ps;
	StackInite(&ps);
	StackPush(&ps, 1);
	StackPush(&ps, 2);
	StackPush(&ps, 3);
	StackPush(&ps, 4);
	STDataType x = StackTop(&ps);
	printf("%d ", x);
}


bool isValid(char* s) {
    stack ps;
    StackInite(&ps);

    while (*s) {
        if (*s == '(' || *s == '[' || *s == '{') {
            StackPush(&ps, *s);
            s++;
        }
        else {
            if (StackEmpty(&ps)) {
                return false;
            }
            STDataType tmp = StackTop(&ps);
            StackPop(&ps);
            if ((*s == ')' && tmp != '(') || (*s == ']' &&
                tmp != '[') || (*s == '}' && tmp != '{')) {
                StackDestory(&ps);
                return false;
            }
        }

        s++;
    }

    bool ret = StackEmpty(&ps);

    StackDestory(&ps);
    return ret;



}





int main() {
	test();
	return 0;
}
